[codex] Share safe URL diagnostics#3403
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Needs human review Diff is too large for automated approval analysis. A human reviewer should evaluate this PR. You can customize Macroscope's approvability policy. Learn more. |
Dismissing prior approval to re-evaluate ef9ed1e
Dismissing prior approval to re-evaluate e445dc2
Dismissing prior approval to re-evaluate 9e3a040
Dismissing prior approval to re-evaluate c41bc6c
Dismissing prior approval to re-evaluate 6dabb2f
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
c91fad6 to
9e0c536
Compare
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Summary
Error context often needs enough URL information to correlate failures without retaining secrets. Several clients had independently added local URL parsers, increasing the chance that credentials, paths, query parameters, fragments, or signed tokens would leak into logs and telemetry.
This shared foundation adds two deliberately separate helpers:
getUrlDiagnosticsfrom the explicit@t3tools/shared/urlDiagnosticssubpath returns only{ inputLength, protocol?, hostname? }. Invalid input returns length only; it never exposes path, userinfo, query, or fragment data.redactDpopRequestTargetremains in@t3tools/shared/dpopfor the narrower DPoP use case, where scheme/host/port/path are part of the request-target diagnostics while credentials/query/fragment are removed.Focused tests cover sensitive valid URLs and invalid input for both policies.
Validation
vp test run packages/shared/src/urlDiagnostics.test.ts packages/shared/src/dpop.test.ts(10 tests)vp check(passes with 20 pre-existing warnings)vp run typecheckNote
Add safe URL diagnostics to errors across the stack to prevent secret leakage
getUrlDiagnosticsandredactDpopRequestTargetutilities in@t3tools/sharedthat extract only safe URL fields (hostname, protocol, input length) without retaining credentials, query strings, or fragments.Errorthrows andData.TaggedErrorclasses throughout server, web, mobile, desktop, and relay packages with structuredSchema.TaggedErrorClasstypes that include operation context, safe URL diagnostics, and preserved causes.ConnectionStorageOperationError,IndexedDbUnavailableError,DesktopSecureStorageUnavailableError, andConnectionPersistenceErrorstructured types in the client-runtime to unify storage failure reporting with operation, backend, and resource context.SSH_PASSWORD_PROMPT_CANCELLED_RESULTwithDesktopSshPasswordPromptCancellationErroracross desktop IPC, preload, and contract boundaries so SSH cancellations surface as typed structured errors._tagvalues, message strings, and field shapes are changed across public contracts — callers that pattern-match on old tags, messages, or fields (e.g.detailvsmessage,KeybindingsConfigParseError→KeybindingsConfigError) will need updates.Macroscope summarized 761be94.
Note
Medium Risk
Broad changes to error
_tagvalues, field shapes, andmessage/detailstrings across IPC, preload, and mobile UI; consumers matching old tags or reading raw messages may break, though behavior is largely preserved with safer diagnostics.Overview
Standardizes failure handling across desktop, mobile, server, and shared clients by replacing swallowed booleans, generic
Errorthrows, and stringly IPC payloads with EffectSchema.TaggedErrorClasstypes that carry operation context and acause, while user-facing **messagegetters avoid echoing secrets or nested causes.Safe URL context comes from shared helpers (
getUrlDiagnostics,redactDpopRequestTarget): errors and logs keep length / protocol / hostname (or redacted DPoP request targets) instead of full URLs, paths, query strings, or credentials. DesktopElectronShellnow failsopenExternal/copyTextwith typed errors; window IPC still returnsfalsefor failed opens but logs redacted structured fields. SSH password prompt cancellation moves from a stringtypetoDesktopSshPasswordPromptCancellationErrorwith reason, request id, and destination.Mobile connection catalog, migration, and file-backed shell/thread cache map storage failures through
ConnectionStorageOperationError/ConnectionPersistenceErrorwith stage and resource metadata. Cloud link/DPoP paths split the old monolithic link error into discriminated types (operation, mismatch, relay/environment sub-errors) with redacted relay/HTTP diagnostics. UI surfaces connection discovery errors viadetailwhere applicable. ServerEnvironmentAuthnarrows service error unions and enriches auth errors (scopes, session ids, DPoP replay keys, credential kind). Thread outbox delivery treatsEnvironmentRpcUnavailableErroras retryable.Reviewed by Cursor Bugbot for commit 761be94. Bugbot is set up for automated code reviews on this repo. Configure here.